import os
keyword='he'
file=os.walk('.')
foundfile=[]
for each in file:
    for each2 in each[2]:
        ext=os.path.splitext(each2)
        if ext[1] =='.txt' or ext[1] =='.TXT':
            fullpath=each[0]+os.sep+each2
            fs=open(each[0]+os.sep+each2)
            templine='temp'
            while templine!='':
                templine=fs.readline()
                location=templine.find(keyword)
                if location!=-1:
                    foundfile.append(fullpath)
                    fs.close()
                    break
print(foundfile)
for x in foundfile:
    xx={}
    f=open(x)
    while f.readline()!=-1:
        f.readline().find(keyword)

    if a=-1:
        continue
            # for eachdict in dict:
            #     print('关键字出现在第%s行，第%s个位置。'%(eachdict,dict(eachdict))
            # fs.close()

            # print(founded)
            # print(dict)


